import request from '@/utils/request'

// rooms search 宿舍房间搜索
export function getRoomList(data) {
  return request({
    url: '/rooms/search',
    method: 'post',
    data
  })
}

// rooms add 宿舍房间新增
export function addRoom(data) {
  return request({
    url: '/rooms/add',
    method: 'post',
    data
  })
}

// rooms delete 宿舍房间删除
export function deleteRoom(params) {
  return request({
    url: '/rooms/delete',
    method: 'post',
    params
  })
}

// rooms update 宿舍房间更新
export function updateRoom(data) {
  return request({
    url: '/rooms/update',
    method: 'post',
    data
  })
}

// 获取当前用户房间信息
export function getRoomByUser() {
  return request({
    url: '/rooms/getRoomByUser',
    method: 'get'
  })
}

// 入住
export function checkInRoom(roomId) {
  return request({
    url: '/rooms/checkIn',
    method: 'post',
    params: {
      roomId
    }
  })
}

// 退房
export function checkOutRoom(roomId) {
  return request({
    url: '/rooms/checkOut',
    method: 'post',
    params: {
      roomId
    }
  })
}

// 获取所有房间
export function getAllRoom() {
  return request({
    url: '/rooms/get',
    method: 'get'
  })
}
